<template>
	<view class="uni_box home">
		<navbar title='案件咨询'>
		</navbar>
		<view class="content">
			<view class="anone" v-if="type =='edit'">
				<view class="anoneitem">
					<image class="icon_aj" src="/static/img/icon_aj.png"></image>
					<text class="antit">案件状态:{{ info.status_name }}</text>
				</view>
				<view class="guview" v-if="info.seized">
					<text class="guname">服务顾问：<text class="guval">{{info.seized.name}}</text></text>
					<text class="guname" @click="callPhone(info.seized.phone)">联系方式：<text class="guval">{{info.seized.phone}}</text></text>
				</view>
			</view>
			<view class="antwo">
				<view class="anlist">
					<text class="antit">联系人：</text>
					<u-input v-model="info.name" :disabled="id?true:false" type="text" :border="false" placeholder="请输入"/>
				</view>
				<view class="anlist">
					<text class="antit">联系方式：</text>
					<u-input v-model="info.phone"  :disabled="id?true:false" type="text" :border="false" placeholder="请输入"/>
				</view>
				<view class="anlist neiview">
					<text class="antit nei">咨询内容：</text>
					<view class="wenben">
						<u-input v-model="info.describe"  :disabled="id?true:false" type="textarea" :border="false" placeholder="请输入"/>
					</view>
				</view>
			</view>
			
			<view class="antwo" v-if="info.reply">
				<view class="anlist neiview">
					<text class="antit nei">回复内容：</text>
					<view class="wenben">
						<u-input v-model="info.reply" type="textarea" :border="false" placeholder="请输入"/>
					</view>
				</view>
			</view>
			

			<view class="botview" v-if="type == 'add'">
				<view class="botbtn" @click="gettijiao">提交信息</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				value:'',
				type:'add',
				info:{
					reply:'',
					name:'',
					phone:'',
					describe:''
				},
				id:''
				
			}
		},
		onLoad(option) {
			this.type = option.type
			if(option.id){
				this.id = option.id
				this.getdetail()
			}
			
		},
		onShow() {
		},
		methods: {
			async getdetail(){
				let res = await this.$u.api.caseinfo({
					id:this.id
				});
				this.info = res.info
			},
			async gettijiao(){
				let res = await this.$u.api.casepost(this.info);
				this.$u.toast("操作成功");
				this.info={
					reply:'',
					name:'',
					phone:'',
					describe:''
				}
				setTimeout(() => {
					uni.navigateBack()
				}, 1000);
			},
			callPhone(phone) {
			// 电话号码为示例，请替换为实际需要拨打的号码
			const phoneNumber = phone;
			uni.makePhoneCall({
				phoneNumber: phoneNumber, // 电话号码
				success: function () {
				console.log('拨打电话成功');
				},
				fail: function () {
				console.log('拨打电话失败');
				}
			});
			}
		}
	}
</script>

<style lang="scss" scoped>
	page{
		background-color: #F5F5F5;
	}
	.content{
		background-color: #F5F5F5;
		padding-bottom: 150rpx;
		.anone{
			background: #FFFFFF;
			border-radius: 20rpx;
			margin: 30rpx 30rpx 0;
			padding: 30rpx;
			display: flex;
			flex-direction: column;
			.anoneitem{
				display: flex;
				flex-direction: row;
				align-items: center;
			}
			.icon_aj{
				margin-right: 7rpx;
				width: 40rpx;
				height: 40rpx;
			}
			.antit{
				font-family: PingFang SC;
				font-weight: bold;
				font-size: 32rpx;
				color: #111111;
			}
		}
		.guview{
			background: #F2F4FA;
			border-radius: 10rpx;
			padding: 30rpx;
			margin: 30rpx 0 0;
			.guname{
				display: block;
				font-family: PingFang SC;
				font-weight: 500;
				font-size: 28rpx;
				color: #333333;
				margin-bottom: 15rpx;
			}
			.guval{
				display: inline-block;
				margin-left: 10rpx;
				font-weight: bold;
				font-size: 28rpx;
				color: #3E65E5;
			}
			.guname:last-child{
				margin-bottom: 0;
			}
		}
		.antwo{
			background: #FFFFFF;
			border-radius: 20rpx;
			margin: 30rpx 30rpx 0;
			padding: 30rpx;
			display: flex;
			flex-direction: column;
			.anlist{
				display: flex;
				flex-direction: row;
				align-items: center;
				padding: 20rpx 0;
				border-bottom: 1rpx solid #EEEEEE;
				.antit{
					font-family: PingFang SC;
					font-weight: 500;
					font-size: 28rpx;
					color: #111111;
				}
			}
			.neiview{
				flex-direction: column;
				align-items: flex-start;
				border-bottom: none;
				
			}
			.wenben{
				height: 200rpx;
				background: #F5F5F5;
				border-radius: 20rpx;
				padding: 30rpx;
				width: 100%;
				margin-top: 30rpx;
			}

		}

		.matit{
			font-family: PingFang SC;
			font-weight: bold;
			font-size: 36rpx;
			color: #333333;
			display: block;
			margin: 40rpx 30rpx;
		}
		.nodata{
			margin: 130rpx;
			display: flex;
			flex-direction: column;
			align-items: center;
			justify-content: center;
			.img_kztz{
				width: 540rpx;
				height: 440rpx;
				margin-bottom: 10rpx;
			}
			text{
				font-family: PingFang SC;
				font-weight: 500;
				font-size: 28rpx;
				color: #999999;
			}
		}
		.lview{
			padding: 0 30rpx;
			.items{
				margin-bottom: 20rpx;
				padding: 30rpx;
				background: #FFFFFF;
				border-radius: 10rpx;
				.ione{
					border-bottom: 1rpx solid #EEEEEE;
					padding-bottom: 20rpx;
					font-family: PingFang SC;
					font-weight: bold;
					font-size: 32rpx;
					color: #51565D;
				}
				.itwo{
					margin: 25rpx 0;
					.tiname{
						display: block;
						margin-bottom: 15rpx;
						font-family: PingFang SC;
						font-weight: 500;
						font-size: 28rpx;
						color: #666666;
					}
					.tival{
						color: #3E65E5;
					}
				}
				.cahview{
					padding-top: 30rpx;
					border-top: 1rpx solid #EEEEEE;
					display: flex;
					flex-direction: row;
					align-items: center;
					justify-content: flex-end;
					.chabtn{
						width: 160rpx;
						height: 60rpx;
						background: #3E65E5;
						border-radius: 10rpx;
						display: flex;
						align-items: center;
						justify-content: center;
						font-family: PingFang SC;
						font-weight: 500;
						font-size: 28rpx;
						color: #FFFFFF;

					}
				}
			}
		}
		.botview{
			position: fixed;
			width: 100%;
			height: 120rpx;
			background-color: #fff;
			bottom: 0;
			display: flex;
			align-items: center;
			justify-content: center;
			.botbtn{
				height: 88rpx;
				background: #3E65E5;
				border-radius: 20rpx;
				display: flex;
				align-items: center;
				justify-content: center;
				font-family: PingFang SC;
				font-weight: 500;
				font-size: 32rpx;
				color: #FFFFFF;
				width: 94%;
			}
		}
	}
</style>
